package com.bstek.urule.runtime.builtinaction;

import com.bstek.urule.RuleException;
import com.bstek.urule.model.library.action.annotation.ActionBean;
import com.bstek.urule.model.library.action.annotation.ActionMethod;
import com.bstek.urule.model.library.action.annotation.ActionMethodParameter;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Component;

/**
 * @Author: zhangxin
 * @Date: 2022/4/19 3:14 下午
 * @email： zhangxin1084@xdf.cn
 * @Description：抛出指定话术的异常信息
 */
@Component("urule.exceptionAction")
@ActionBean(name = "抛出异常")
public class ExceptionAction {

    @ActionMethod(name = "抛出异常")
    @ActionMethodParameter(names = "异常信息")
    public void throwException(String message) {
        if (StringUtils.isBlank(message)) {
            return;
        }
        throw new RuleException(message);
    }
}
